/* 
 * job_groups/form.js
 */


$(document).ready(function(){

  // Initialize the Accordion for "Add Job Group"
  $("#accordianWrapper").accordion({
			collapsible: false,
      autoHeight: false // allow each accordian panel to set its own content height (rather than forcing all panels to share the largest height)
      //active: '#jobGroupSelector #open_panel'  // the content panel to display on load
	});


  //$('div.accordionPanel div:not(#jobGroupRadioWrapper)').css('display', 'none');

  // Handle radio btn click on Job Group selection radios
  $('.jobGroupRadios').click(handleJobGroupRadioClick);

  
}); // end document ready func



// Handle radio btn click on Job group dir selection radios
function handleJobGroupRadioClick() {
  
  // The context of "$(this)" here is the radio btn input that was clicked
  
  // TODO: ? somehow replace "/" with a portable directory-separator? (i.e., for windows)
  $('.JobGroupDirAbsPathDiv input').val( $(this).attr('data-jobgroupfullpath') );
  
  $('.submit input[type="submit"]').attr('disabled', false)
                                 .removeClass("disabledSubmit")
                                 .siblings(".tooltipSpan").css('display', 'none');
  
      // Once a radio has been clicked, and the Abs Path is then populated, remove the annoying toolip
      //$('#JobGroupDirAbsPath').closest('div').siblings('span.tooltipSpan').css('display', 'none');
      //$('#JobGroupDirAbsPath').closest('a.cssTooltip').removeAttr('href');

} //////////// end handleJobNameRadioClick() //////////////


